// 南航明珠商城-专题活动管理.js
 function search(){
	 document.getElementsByName("name")[0].value =trim(document.getElementsByName("name")[0].value );
     $("#page").val("1");
     $("#search_form").submit();
 };
 function toIsEmpty(){
	document.getElementsByName("name")[0].value = "";
	document.getElementsByName("displayType")[0].value = "";
	document.getElementsByName("status")[0].value = "";
 };
 
 function addSpecialTopic(){
	var url=path+"/special_topic/to_add_template_special_topic";
	var index = layer.open({
		   type: 2,
		   title: "添加专题活动",
		   scrollbar: false,
		   content: url,
		   area: ['1000px', '600px']
	 });
}
 function delSpecialTopic(id){
	 layer.confirm("确定删除此专题？",function(){
		layer.closeAll('dialog');
		var layer_load_window = layer.load(2); 
		 $.ajax({
				url : path+"/special_topic/delete_special_topic",
				cache : false,
				type : 'post',
				dataType : 'text',
				data:{'specialTopicId':id},
				error : function() {
					layer.alert("操作失败！");
		       },
				success : function(data) {
				    if(data == "success"){
					    layer.msg('删除成功!',{icon:1,time:1000},function(){
					    	$("#search_form").submit();
					    });
				   }else{
					layer.alert(data);
				   }
				},
				complete: function(XMLHttpRequest, textStatus) {
					layer.close(layer_load_window);
				}
			  })	
	 });
 }
 function editSpecialTopic(id){
		var url=path+"/special_topic/to_edit_template_special_topic?specialTopicId="+id;
		var index = layer.open({
			   type: 2,
			   title: "编辑专题活动",
			   scrollbar: false,
			   content: url,
			   area: ['1000px', '600px']
		 });
 }
 function auditSpecialTopic(id){
		var url=path+"/special_topic/to_audit_template_special_topic?specialTopicId="+id;
		var index = layer.open({
			   type: 2,
			   title: "审核专题活动",
			   scrollbar: false,
			   content: url,
			   area: ['1000px', '600px']
		 });
 }
 //js去掉空格
 function trim(str){ 
	 return  str.replace(/^\s+|\s+$/g,"");
 }